package edu.uc.labs.MobilePrinting.PrintUtils;

import edu.uc.labs.MobilePrinting.Configurator;
import java.io.IOException;
import java.util.ArrayList;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.xpath.XPathExpressionException;
import org.xml.sax.SAXException;
import org.apache.log4j.Logger;

/**
 *
 * @author Matthew Silbernagel
 */
public class PrinterFinder {
    
    public static ArrayList<Printer> getList(String directory){
    	Configurator conf = new Configurator();
    	Logger logger = conf.getLogger();
        ArrayList<Printer> printers = null;
        try {
            PrinterParser parser = new PrinterParser();
            printers = parser.parse(directory + Configurator.XMLFILE);
        } catch (SAXException ex) {
        	logger.debug(ex.toString());
        } catch (IOException ex) {
        	logger.debug(ex.toString());
        } catch (XPathExpressionException ex) {
        	logger.debug(ex.toString());
        } catch (ParserConfigurationException ex) {
        	logger.debug(ex.toString());
        }
        return printers;

    }



}
